//
//  DFHomeVC.swift
//  DailyFresh
//
//  Created by Arthur on 2017/9/19.
//  Copyright © 2017年 DailyFresh. All rights reserved.
//

import UIKit
import SnapKit
import AMScrollingNavbar

class DFHomeVC: DFViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        //4.创建pageView
      
        self._setupUI()
    }
    
    fileprivate func _setupUI() {
        
        self.automaticallyAdjustsScrollViewInsets = false

//        let aview = FKView.init(frame: CGRect.init(x: 0, y: 0, width: 44, height: 44))
        self.navigationItem.titleView = self.navTitleView
        
        view.addSubview(segmentView)
        
        self.segmentView.snp.makeConstraints { (make) in
            make.edges.equalTo(self.view).inset(UIEdgeInsetsMake(0, 0, DFLayoutConstants.tabBarHeight, 0))
        }
        
        self.navTitleView.update()
    }
    


    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    lazy var navTitleView: DFNavTitleView = {
        let tmp = DFNavTitleView.init(frame: CGRect.init(x: 0, y: 0, width: 172, height: 44.0))
        return tmp
    }()
    
    lazy var segmentView: DFSegmentView = {
        var  style = DFSegmentStyle()
        style.isScrollEnable = true
        style.isShowBottomLine = true
        style.isNeedMask = false
        
        let titles = ["特价","中秋礼","水果","蔬菜","乳品","肉蛋","饮品","素食","日百"]
        var childvcs = [UIViewController]()
        for i in 0..<titles.count
        {
            let vc  = DFPromotionSaleVC()
            
            let  backgroundcolor = UIColor.white
            vc.view.backgroundColor = backgroundcolor
            childvcs.append(vc)
        }

        let tmp = DFSegmentView(frame: CGRect.zero, style: style, titles: titles, childViewControllers: childvcs, parentViewController: self)
        
        return tmp
    }()

}

extension DFHomeVC {
    
}
